<?php
    include("header.php");
    setTabIndex(2);
    createPage("Liga - Zilveren Toren");
    if (isset($_SESSION['user'])) $user = $_SESSION['user'];
?>

<head>
<title>ZT ploegleiders</title>

<script type="text/javascript" src="/assets/js/dojo-0.4.3-src/dojo.js"
    djConfig="parseOnLoad: true">
</script>
<script type="text/javascript" src="/assets/js/ajax.js"></script>
<script type="text/javascript">
  dojo.require("dojo.widget.ComboBox");
  dojo.require("dojo.parser");
</script>
</head>
<?php
    $connect = mysql_connect(DB_SERVER, DB_USER, DB_PWD);
    mysql_select_db(DB_CATALOG);   
    
    $result = mysql_query("SELECT c.club_id, c.clubname, CONCAT(firstname, ' ', lastname) AS NAME, email, u.username, u.password FROM user u JOIN club c ON c.club_id = u.club_id WHERE user_id IN (SELECT user_id FROM zt_captain WHERE tournament_id = (SELECT tournament_id FROM zt_tournament WHERE isCurrent = 1)  ) ORDER BY c.club_id", $connect);

    $teamLeads = array();
    while ($row = mysql_fetch_assoc($result)) {
        $teamLead = new TeamLead;
        $teamLead->club_id = $row['club_id'];
        $teamLead->club_name = $row['clubname']; 
        $teamLead->name = $row['NAME'];
        $teamLead->email = $row['email'];
        $teamLead->username = $row['username'];
        $teamLead->password = $row['password'];
        array_push($teamLeads, $teamLead);
    }
?>

<body onLoad="document.cp.round.focus()">

<table height="100%" cellSpacing="0" cellPadding="0" width="100%"
    border="0" bgcolor="#FFFFFF">
    <tr>
        <td id="leftFiller" valign="top" height="100%" rowspan="3"
            bgcolor="#666666">
        <table border="0" cellpadding="0" cellspacing="0" height="100%"
            width="8px">
            <tr>
                <td>&nbsp;</td>
            </tr>
        </table>
        </td>
        <td id="header" valign="top" width="100%">
        <table border="0" width="100%" cellpadding="3" cellspacing="0" bgcolor="#10425b">
                <tr>
                    <td bgcolor="#666666" width="40%">
                        <?php include("inc_title.html"); ?>
                    </td>
                    <td bgcolor="#666666" align="right" valign="top">&nbsp;
                          <span class="headerSmall">Huidige versie PLAYER.DBF: <?=CURRENT_PLAYER_DBF?>
                        <?php
                        if (isset($user) && $user->club_id == 100) {
                        ?>
                        <br/>
                        <a class="headerSmall" href="import_player.php">laad andere versie</a>
                        <?php
                        }
                        ?>
                        </span>
                    </td>
                </tr>
            </table>
            <table align="center" border="0" width="100%" height="90%" cellpadding="0" cellspacing="0" style="border-top:#BCDD10 4px solid;">
                <tr>
                    <?php include("inc_sublinks.php"); ?> 
                </tr>
            <tr>
                <td colspan="2" nowrap bgcolor="#BCDD10" height="4"><img
                    src="../../assets/images/spacer.gif" alt="" height="1" width="1"></td>
            </tr>
            <tr>
                <td>&nbsp;</td>
                <td valign="top">
                <table align="left" cellspacing="10" width="70%">
                    <tr>
                        <td>
                        <div id=dojoDebugOutput></div>
                        <span class="blackHeaderLarge">Zilveren Toren <?=CURRENT_ZT_YEAR?>
                        - Ploegleiders</span>
                        </br>&nbsp;</br>
                        Dit zijn de ploegleiders die verantwoordelijk zijn voor de Zilveren Toren administratie.
                        <br/>
                        Een overzicht van de taken van een ploegleider (met uitgebreide handleiding van de applicatie) kan je vinden op de <a href="http://www.schaakliga-antwerpen.info/wiki/index.php/Zilveren_Toren_Handleiding#Taken_ploegleider" target="_blank">Wiki</a>.
                        </br>&nbsp;</br>
                        Ook de <a href="/tornooien/zt-php/zt_clubs.php">contactinformatie</a> wordt door hen beheerd en dient als referentie voor telefoon/adresgegevens.
                        </br>&nbsp;</br>
                        <form name="cp" method="get">
                        <table cellpadding="2" cellspacing="0" border="0" width="95%"> 
                            <tr>
                                <td><strong>Clubnummer</strong></td>
                                <td><strong>Clubnaam</strong></td>
                                <td><strong>Naam</strong></td>
                                <?
                                if ( (isset($user) && $user->club_id == 100) ) {
                                ?>
                                <td><strong>Gebruikersnaam</strong></td>
                                <td><strong>Paswoord</strong></td>
                                <?    
                                }
                                ?>
                            </tr>
                            <?php
                            foreach ($teamLeads as $item) {
                            ?>
                            <tr>
                                <td style="border-bottom:#DDDDDD solid 1px"><?=$item->club_id?></td>
                                <td style="border-bottom:#DDDDDD solid 1px"><?=$item->club_name?></td>
                                <td style="border-bottom:#DDDDDD solid 1px"><?=$item->name?></td>
                            <?
                                if ( (isset($user) && $user->club_id == 100) ) {
                                ?>
                                <td style="border-bottom:#DDDDDD solid 1px"><?=$item->username?></td>
                                <td style="border-bottom:#DDDDDD solid 1px"><?=$item->password?></td>
                                <?    
                                }
                                ?>
                            </tr>
                            <?php
                            }
                            ?>
                        </table>
                        </form>
                        </td>
                    </tr>
                </table>
                </td>
            </tr>
        </table>

        <?php include("footer.php"); ?>